module executor.user.client.QrCodeExecutor;

import msgtrans;
import message.Constants;
import message.MsgDefine;
import google.protobuf;
import client.ImClient;
import std.array;
import command.StartAppCommand;
import std.conv: to;
import hunt.logging;

@TransportClient(logicClientName)
class QrCodeExecutor : AbstractExecutor!(QrCodeExecutor){

   @MessageId(MESSAGE.CMD_MAKE_QRCODE_RES)
    void makeQrCode(TransportContext ctx, MessageBuffer buffer)
    {
      auto res = new MakeQrCodeRES();
      buffer.data.fromProtobuf!MakeQrCodeRES( res);
      TransportSession[] clients =  ImClient.getInstance().getImClient(to!ulong(res.userId));
      foreach (TransportSession client ; clients)
      {
        client.send(new MessageBuffer(MESSAGE.CMD_MAKE_QRCODE_RES,res.toProtobuf.array));
      }
    }
}

